home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_361 / xcolor-lib / xcolor-library.doc < prev    next >
Text File  |  1992-05-06  |  13KB  |  634 lines

  1.  
  2.  
  3.                           XCOLOR-LIBRARY 
  4.  
  5.    ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  6.  
  7.                     Author: Roger Fischlin
  8.                             Steigerwaldweg 6
  9.                             6450 Hanau 7
  10.                             West Germany
  11.  
  12.                     Phone : (06181) 650266
  13.  
  14.  
  15.  
  16.  
  17.  
  18.   General
  19.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  20.  
  21.   The XColor-Library gives you some functions for manipulating
  22.   colors, eg. a color requester.
  23.  
  24.   Nearly all functions have a direct effect on the ColorMap,
  25.   so RemakeDisplay (Intuition-Library) has to be executed for
  26.   making the changes visible. There are two reasons for that :
  27.  
  28.   · RemakeDisplay forbids multitasking !
  29.  
  30.   · All changes get visible by once !
  31.  
  32.  
  33.    
  34.   If you open the XColor-Library, you will also get the
  35.   pointers to the Graphics- , FFP- and Intuition-Library, that 
  36.   are part of the XColor-Library base.
  37.  
  38.  
  39.  
  40.  
  41.   Copyright :
  42.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  43.  
  44.   The XColor-Library is NO Public Domain. The Author, Roger
  45.   Fischlin, holds the copyright. The XColor-Library may be 
  46.   distributed on PD-disks , if ...
  47.  
  48.   · no profit is made !!!!
  49.   · no changes are made !
  50.  
  51.   So you can include the Xcolor-Library with a PD-disk. This
  52.   text need not be included.
  53.   
  54.  
  55.  
  56.   This library may be distributed with commercial software,
  57.   if ...
  58.  
  59.   · no changes are made !
  60.   · this unchanged text is included !  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.   Bugs
  69.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  70.  
  71.   If there are any bugs, please send me an exact report.
  72.  
  73.  
  74.  
  75.  
  76.   include files
  77.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  78.  
  79.   There are include files for 
  80.   · DevPac Assember 
  81.   · KickPascal
  82.   · C          (by Oliver Wagner)
  83.   · AmigaBasic (by Oliver Wagner)
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.   Instructions for the Usage of the colour requesters
  92.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  93.  
  94.   As most functions should be evident, I just want to explain    
  95.   four things :
  96.  
  97.   1. RGB <-> HSV
  98.  
  99.      By selecting  RGB / HSV  you can alternate between  RGB-
  100.      and HSV-scale.
  101.  
  102.   2. hex <-> decimal 
  103.    
  104.      Using the RGB-scale you can alternate between hexadecimal
  105.      and decimal display, the number of the color will be
  106.      diplayed hexadicimally (without $-character) or decimally,
  107.      too.
  108.  
  109.   3. The Undo-gadget for the color that is displayed is on
  110.      the left side, above the number of the color.
  111.  
  112.   4. All functions (COPY, SPREAD, EXCHANGE) may be canceled
  113.      by re-selecting.
  114.  
  115.  
  116.  
  117.  
  118.   
  119.  
  120.  
  121.   Colour <-> Color
  122.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  123.  
  124.   I used COLOUR  when  I wrote  the library  but I also have
  125.   added COLOR.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.   Functions of XColor.Library :
  137.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.   CheckColour
  146.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  147.  
  148.  
  149.   function     : CheckColour
  150.  
  151.   Offset       : -30
  152.  
  153.   Inputs       :  d0   - Number of colour (pen)
  154.                   a0   - ^ViewPort
  155.  
  156.   Return       :  1    - EHB colour
  157.                   0    - standard colour
  158.                  -1    - colour doesn't exist
  159.  
  160.  
  161.   Purpose      : This function returns the type of the colour.
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.   ReadRGB4
  170.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  171.  
  172.  
  173.   function     : ReadRGB4
  174.  
  175.   Offset       : -36
  176.  
  177.   Inputs       :  d0   - Number of colour (pen)
  178.                   a0   - ^ViewPort
  179.  
  180.   Return       :  RGB  - colorvalue (word)
  181.                   -1   - no such color register
  182.  
  183.  
  184.   Purpose      : This function returns the RGB values of the colour
  185.                  as a word :
  186.                  
  187.                  (R * 2^8) + (G * 2^4) + B 
  188.  
  189.                  
  190.                  If this is an EHB-color, it will just be half as
  191.                  bright as an usual one.
  192.  
  193.   also look for : WriteRGB4
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.   WriteRGB4
  202.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  203.  
  204.  
  205.   function     : WriteRGB4
  206.  
  207.   Offset       : -42
  208.  
  209.   Inputs       :  d0   - register of color
  210.                   d1   - RGB-value as a word
  211.                   a0   - ^ViewPort
  212.  
  213.   Return       :   0   - OK
  214.                   -1   - no such register
  215.  
  216.  
  217.   Purpose      : This function writes the colorvalue into the
  218.                  ColorMap of the ViewPorts.
  219.                  If this register is an EHB-color, the brightness
  220.                  will be doubled and this RGB-value will be
  221.                  written into the register, so the EHB-color
  222.                  will have the RGB-value. 
  223.                  As this value is directly written into the
  224.                  ColorMap, RemakeDisplay (Intuition-Library)has to
  225.                  be executed.
  226.  
  227.  
  228.   also look for : ReadRGB4
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.   ColorMapAddress
  237.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  238.  
  239.  
  240.   function     : ColorMapAddress
  241.  
  242.   Offset       : -48
  243.  
  244.   Inputs       :  d0   - kind of structure
  245.                   a0   - ^structure
  246.  
  247.   Return       : <>0   - pointer to ColorMap
  248.                    0   - wrong kind of structure
  249.  
  250.  
  251.   Purpose      : This function gets the pointer to the ColorMap.
  252.                  There are three possible structures :
  253.  
  254.                  0 : ViewPort
  255.                  1 : Window
  256.                  2 : Screen
  257.  
  258.  
  259.  
  260.  
  261.  
  262.   ExchangeColours
  263.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  264.  
  265.  
  266.   function     : ExchangeColours
  267.  
  268.   Offset       : -54
  269.  
  270.   Inputs       :  d0   - register of the first color
  271.                   d1   - register of the second color
  272.                   a0   - ^ViewPort
  273.  
  274.   Return       :   0   - OK
  275.                   -1   - no such register(s), 
  276.                          or these are different kinds of registers
  277.                          (EHB and RGB) 
  278.  
  279.   Purpose      : This function exchanges two values of the Color-
  280.                  Map of the ViewPort.
  281.                  If both registers are EHB-colors, the lower
  282.                  registers belonging to each other will be
  283.                  transfered.
  284.                  As only the ColorMap is changed, the copperlist
  285.                  must be rebuilt with RemakeDisplay (Intuition-
  286.                  Library), before any change will be visible.
  287.  
  288.  
  289.   also look for : CopyColours, SpreadColours
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.   CopyColours
  298.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  299.  
  300.  
  301.   function     : CopyColours
  302.  
  303.   Offset       : -60    
  304.  
  305.   Inputs       :  d0   - register of the first  color (   Source    ) 
  306.                   d1   - register of the second color ( Destination )
  307.                   a0   - ^ViewPort
  308.  
  309.   Return       :   0   - OK
  310.                   -1   - no such register(s), 
  311.                          or these are different kinds of registers
  312.                          (EHB and RGB)
  313.  
  314.   Purpose      : This function copies the RGB-value of a register
  315.                  to another of the ColorMap of the ViewPort.
  316.                  If both registers are EHB-colors, the lower
  317.                  registers belonging to each other will be
  318.                  transfered.
  319.                  As only the ColorMap is changed, the copperlist
  320.                  must be rebuilt with RemakeDisplay (Intuition-
  321.                  Library), before any change will be visible.
  322.  
  323.  
  324.   also look for : ExchangeColours, SpreadColours
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.   SpreadColours
  333.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  334.  
  335.  
  336.   function     : SpreadColours
  337.  
  338.   Offset       : -66
  339.  
  340.   Inputs       :  d0   - register of the first  color
  341.                   d1   - register of the second color
  342.                   a0   - ^ViewPort
  343.  
  344.   Return       :   0   - OK
  345.                   -1   - no such register(s), 
  346.                          or these are different kinds of registers
  347.                          (EHB and RGB) 
  348.  
  349.   Purpose      : This function adepts the colors between the two
  350.                  register of the ColorMap of the ViewPort to the
  351.                  difference of them.
  352.                  If both registers are EHB-colors, the lower
  353.                  registers belonging to each other will be
  354.                  changed.
  355.                  As only the ColorMap is changed, the copperlist
  356.                  must be rebuilt with RemakeDisplay (Intuition-
  357.                  Library), before any change will be visible.
  358.  
  359.  
  360.   also look for : ExchangeColours, CopyColours
  361.  
  362.  
  363.                  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.   ColourDepth
  372.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  373.  
  374.  
  375.   function     : ColourDepth
  376.  
  377.   Offset       : -72
  378.  
  379.   Inputs       :  a0   - ^Screen
  380.  
  381.   Return       : Depth - depth of the screen ( HAM-Mode = 4 and 
  382.                          EHB-Mode = 6 ).
  383.  
  384.   Purpose      : This function gets log2 of the
  385.                  number of color.
  386.  
  387.  
  388.   also look for : ColourNumber
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.   ColourNumber
  398.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  399.  
  400.  
  401.   function     : ColourNumber
  402.  
  403.   Offset       : -78
  404.  
  405.   Inputs       :  a0   - ^Screen
  406.  
  407.   Return       : number- number of colors of a screen,
  408.                          ( HAM-Mode = 16 and EHB-Mode = 64 ).
  409.                          
  410.  
  411.   Purpose      : This function gets the number of colors.
  412.  
  413.  
  414.   also look for : ColourDepth
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.   MakeAntique
  422.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  423.  
  424.  
  425.   function     : MakeAntique
  426.  
  427.   Offset       : -84
  428.  
  429.   Inputs       :  d0   - number of color (starting color)
  430.                   d1   - number of registers
  431.                   a0   - ^ViewPort
  432.  
  433.   Return       :   0   - OK
  434.                   -1   - no such register
  435.  
  436.  
  437.   Purpose      : This function makes the number of registers
  438.                  from the starting color look antique.
  439.                  As only the ColorMap is changed, the copperlist
  440.                  must be rebuilt with RemakeDisplay (Intuition-
  441.                  Library), before any change will be visible.
  442.  
  443.  
  444.   also look for : MakeBW
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.   MakeBW
  452.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  453.  
  454.  
  455.   function     : MakeBW
  456.  
  457.   Offset       : -90
  458.  
  459.   Inputs       :  d0   - number of color (starting color)
  460.                   d1   - number of register
  461.                   a0   - ^ViewPort
  462.  
  463.   Return       :   0   - OK
  464.                   -1   - no such register.
  465.  
  466.  
  467.   Purpose      : This function makes the number of registers
  468.                  from the starting color on look black and white.
  469.                  As only the ColorMap is changed, the copperlist
  470.                  must be rebuilt with RemakeDisplay (Intuition-
  471.                  Library), before any change will be visible.
  472.  
  473.  
  474.   also look for : MakeAntique
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.   CopyToBuffer
  483.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  484.  
  485.  
  486.   function     : CopyToBuffer
  487.  
  488.   Offset       : -96
  489.  
  490.   Inputs       :  d0   - number of color 
  491.                   d1   - number of registers
  492.                   a0   - ^ViewPort
  493.                   a1   - ^buffer
  494.  
  495.   Return       : number- number of copied registers
  496.  
  497.  
  498.   Purpose      : This function copies the registers of the ColorMap
  499.                  of the ViewPort to the buffer.
  500.                  As only the ColorMap is changed, the copperlist
  501.                  must be rebuilt with RemakeDisplay (Intuition-
  502.                  Library), before any change will be visible.
  503.  
  504.  
  505.   also look for : CopyToColorMap
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.   CopyToColorMap
  516.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  517.  
  518.  
  519.   function     : CopyToColorMap
  520.  
  521.   Offset       : -102
  522.  
  523.   Inputs       :  d0   - number of color (starting color)
  524.                   d1   - number of registers
  525.                   a0   - ^ViewPort
  526.                   a1   - ^buffer
  527.  
  528.   Return       : number- number of copied register
  529.  
  530.  
  531.   Purpose      : This function copies the values of the buffer
  532.                  into the registers of the ColorMap of the Viewport
  533.                  from the starting color on.
  534.  
  535.  
  536.   also look for : CopyToBuffer
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.   HSVtoRGB
  545.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  546.  
  547.  
  548.   function     : HSVtoRGB
  549.  
  550.   Offset       : -108
  551.  
  552.   Inputs       :  d0   - H ($0000-$ffff)
  553.                   d1   - S ($0000-$ffff)
  554.                   d2   - V ($0000-$ffff)
  555.  
  556.   Return       :  RGB  - RGB-value from HSV-value (as a word).
  557.                          
  558.  
  559.   Purpose      : This function gets the RGB-value from the
  560.                  HSV-value. Many painting programs (eg. DPaint) use 
  561.                  RGB-values and HSV-values.
  562.  
  563.  
  564.   also look for : RGBtoHSV
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.   RGBtoHSV
  572.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  573.  
  574.  
  575.   function     : RGBtoHSV
  576.  
  577.   Offset       : -114
  578.  
  579.   Inputs       :  d0   - RGB as a word
  580.                   a0   - ^buffer (3 longwords = 12 bytes)
  581.  
  582.   Return       :       - HSV-value as a longword in the buffer 
  583.                          
  584.  
  585.   Purpose      : This function gets the HSV-value from a RGB-value.
  586.                  The HSV-values are to find seperated as longwords
  587.                  ($0000-$ffff) in the buffer 
  588.                  
  589.  
  590.  
  591.   also look for : HSVtoRGB
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.   ColourRequester
  600.   ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  601.  
  602.  
  603.   function     : ColourRequester
  604.  
  605.   Offset       : -120
  606.  
  607.   Inputs       :  a0   - ^colour requester structure
  608.  
  609.   Return       :   0   - OK
  610.                   <0   - error
  611.                          
  612.  
  613.   Purpose      : The colour requester-function gives you 
  614.                  a palette for changing the colors. You can
  615.                  create your own requester by using the options 
  616.                  and vectors.
  617.                  
  618.                  
  619.                  
  620.                  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.                  
  632.  
  633.  
  634.